<?php $this->load->view('layout/header');?>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <h3 class="page-title">旅游商品<small>编辑商品供应商</small></h3>
            <?php echo breadcrumb(array('tourismgoods/grid'=>'旅游商品', 'tourismprovider/edit/'.$provider->id=>'编辑商品供应商')); ?>
        </div>
    </div>
    <?php echo execute_alert_message()?>
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-plus-sign"></i>编辑商品供应商</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body form">
                    <form class="form-horizontal line-form" action="<?php echo base_url('tourismprovider/editPost') ?>" method="post" enctype="multipart/form-data">
                        <div class="control-group">
                            <label class="control-label"><em>* </em>供应商uid</label>
                            <div class="controls">
                                <input type="hidden" name="id" value="<?php echo $provider->id;?>">
                                <input type="text" name="uid" value="<?php echo $provider->uid;?>" class="m-wrap large required number" readonly="readonly">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>店铺名称</label>
                            <div class="controls">
                                <input type="text" class="m-wrap large required" name="name" value="<?php echo $provider->name ?>" />
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>公司名称</label>
                            <div class="controls"> 
                                <input type="text" name="company_name" class="m-wrap large required" value="<?php echo $provider->company_name;?>" />
                            </div>
                        </div>
                         <div class="control-group">
                            <label class="control-label"><em>* </em>公司地址</label>
                            <div class="controls">
                                <input type="text" name="company_address" class="m-wrap large required" value="<?php echo $provider->company_address;?>" />
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>主营业务</label>
                            <div class="controls">
                                 <input type="text" name="main_business" class="m-wrap large required" value="<?php echo $provider->main_business;?>"/>
                            </div>
                        </div>
                        <div class="control-group ">
                            <label class="control-label"><em>* </em>店铺简介</label>
                            <div class="controls">
                                <textarea name="detail" class="m-wrap span8 required textarea-multipart-edit" rows="3"><?php echo $provider->detail ?></textarea>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>站点独立</label>
                            <div class="controls">
                                <label class="radio">
                                    <input type="radio" value="1" name="site_apart" <?php if ($provider->site_apart=== '1') :?>checked="checked"<?php endif;?>/>是
                                </label>
                                <label class="radio">
                                    <input type="radio" value="0" name="site_apart" <?php if ($provider->site_apart=== '0') :?>checked="checked"<?php endif;?>/>否
                                </label>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>所属分类</label>
                            <div class="controls">
                                <select name="category_id" class="m-wrap large required">
                                   <option value="0">无分类</option>
                                   <?php foreach($category->result() as $item):?>
                                   <option value="<?php echo $item->id;?>" <?php if($provider->category_id==$item->id):?>selected="selected"<?php endif;?>><?php echo $item->name;?></option>
                                   <?php endforeach;?>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>上下架</label>
                            <div class="controls">
                                <select class="large m-wrap" tabindex="1" name="flag">
                                   <option value="1" <?php if($provider->flag==1):?>selected="selected"<?php endif;?>>上架</option>
                                   <option value="2" <?php if($provider->flag==2):?>selected="selected"<?php endif;?>>下架</option>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">排序</label>
                            <div class="controls">
                                <input type="text" name="sort" value="<?php echo $provider->sort ?>" class="m-wrap large required" placeholder="越大越前">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">logo图片</label>
                            <div class="controls">
                                <div class="file-image" style="width: 120px;height: 120px;float: left;">
                                    <img src="<?php echo $this->config->show_image_url($provider->logo)?>" width=110 height="100">
                                </div>
                                <input type="file" name="logo">
                                <input type="hidden" name="logo" value="<?php echo $provider->logo ?>">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">wap端背景图片</label>
                            <div class="controls">
                                <div class="file-image" style="width: 120px;height: 120px;float: left;">
                                    <img src="<?php echo $this->config->show_image_url($provider->wap_image)?>" width=110 height="100">
                                </div>
                                <input type="file" name="wap_image">
                                <input type="hidden" name="wap_image" value="<?php echo $provider->wap_image ?>">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">客服背景<br />(640×220)</label>
                            <div class="controls">
                                <div class="file-image" style="height: 160px;float: left;">
                                    <img src="<?php echo $this->config->show_image_url($provider->service_image)?>" height="160">
                                </div>
                                <input type="file" name="service_image">
                                <input type="hidden" name="service_image" value="<?php echo $provider->service_image?>">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">客服电话</label>
                            <div class="controls">
                                <input type="text" name="service_mobile" value="<?php echo $provider->service_mobile;?>" class="m-wrap large"/>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">客服微信<br />(二维码)</label>
                            <div class="controls">
                                <div class="file-image" style="height: 160px;float: left;">
                                    <img src="<?php echo $this->config->show_image_url($provider->service_wx)?>" height="160">
                                </div>
                                <input type="file" name="service_wx">
                                <input type="hidden" name="service_wx" value="<?php echo $provider->service_wx?>">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">客服QQ</label>
                            <div class="controls">
                                <input type="text" name="service_qq" value="<?php echo $provider->service_qq;?>" class="m-wrap large" placeholder="多个QQ用,号隔开 （如 12365453,22363123）"/>
                            </div>
                        </div>
                        <div class="form-actions">
                            <button class="btn green" type="submit"><i class="icon-ok"></i>保存</button>
                            <a href="<?php echo base_url('tourismprovider/grid') ?>">
                                <button class="btn" type="button">返回</button>
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $this->load->view('layout/footer');?>
<script type="text/javascript">
    $('.form-horizontal').on('change', 'input[type=file]', function (e) {
        var $this = $(this);
        upLoadImg(e.currentTarget.files[0], function (obj) {
            console.log(obj);
            $this.siblings('[type=hidden]').val(obj.save_path);
            $this.siblings('.file-image').children('img').attr('src', obj.file_url);
        });
    });
</script>
